'use strict';
/* jshint mocha: true */
var path = require('path');
var expect = require('chai').expect;
var Injector = require('../');
var examplePath = path.resolve(__dirname, '../example');

describe('test-load', function () {
    it('It should has load correct module', function () {
        var injector = new Injector([examplePath]);
        expect(injector.load('types/type1')).to.equal(true);
        var mod = injector.getModule('types/type1');
        expect(mod).to.equal('type1');
    });
    it('It should has load correct module from multiple includePaths', function () {
        var injector = new Injector([examplePath, examplePath+'/lib']);
        expect(injector.load('types/type1')).to.equal(true);
        var mod = injector.getModule('types/type1');
        expect(mod).to.equal('type1');
        var injector2 = new Injector([examplePath+'/lib', examplePath]);
        expect(injector2.load('types/type1')).to.equal(true);
        var mod2 = injector2.getModule('types/type1');
        expect(mod2).to.equal('type1 in the lib directory');
    });
    it('It should not load the module that dose not exist', function () {
        var injector = new Injector([examplePath]);
        expect(injector.load('types/type2')).to.equal(false);
        var mod = injector.getModule('types/type2');
        expect(mod).to.be.an('undefined');
    });
});